<?php
require_once ('admin.head.php');
ob_clean();
if(!isset($_GET['add']) && !isset($_GET['delete'])) {
    exit;
}

if(isset($_GET['add'])) {
    $data = $_POST;

    $required = array(
        'mb_name'=> '이름',
        'mb_nick'=> '애칭',
        'mb_sex'=> '성별',
        'mb_id'=> 'ID',
        'mb_password' =>'비밀번호',
        'mb_jumin'=> '주민번호',
        'mb_addr2'=> '주소',
        'mb_birth'=>'생년월일',
        'mb_email'=> '이메일',
        'mb_tel'=> '연락처1',
        'mb_hp'=> '핸드폰',
        'mb_introduce'=>'자기소개',
        'mb_career'=> '경력',
    );
    //requireProcess($required); //TODO 문서 보고 처리할것

    $fields = array(
        'mb_name',
        'mb_nick',
        'mb_student_level',
        'mb_mom_name',
        'mb_realtion',
        'mb_email',
        'mb_tel',
        'mb_moretel',
        'mb_hp',
        'mb_sms',
        'mb_mailling',
        'mb_refund_bank',
        'mb_refund_account',
        'mb_student_level',
    );

    putDb('g4_member', $data, $fields);
    redirectBefore();
} else if(isset($_GET['delete'])) {
    $sql = "DELETE FROM g4_member WHERE mb_id = '{$_GET['mb_id']}'";
    mysql_query($sql);
    redirect('members.php');
}
